* for more details.
*/
-#include <QAbstractButton>
-#include <QtCore>
-#include <QProcess>
-#include <QMessageBox>
-#include <QDesktopServices>
-#include <QApplication>
-
#include "accessmanager.h"
#include "account.h"
#include "accountmanager.h"
#include "sslerrordialog.h"
#include "wizard/owncloudwizard.h"
#include "wizard/owncloudwizardcommon.h"
+#include "connectionvalidator.h"
#include "creds/credentialsfactory.h"
#include "creds/abstractcredentials.h"
#include "creds/dummycredentials.h"
+#ifdef BUILD_FILE_PROVIDER_MODULE
+#include "gui/macOS/fileprovider.h"
+#endif
+
+#include <QAbstractButton>
+#include <QtCore>
+#include <QProcess>
+#include <QMessageBox>
+#include <QDesktopServices>
+#include <QApplication>
+
namespace OCC {
OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent)
job->setFollowRedirects(false);
job->setProperties(QList<QByteArray>() << "getlastmodified");
connect(job, &PropfindJob::result, _ocWizard, &OwncloudWizard::successfulStep);
- connect(job, &PropfindJob::finishedWithError, this, &OwncloudSetupWizard::slotAuthError);
+ connect(job, &PropfindJob::finishedWithError, this, [this] (QNetworkReply *reply) {
+ if (reply && reply->error() == QNetworkReply::ContentAccessDenied) {
+ testTermsOfService();
+ } else {
+ slotAuthError();
+ }
+ });
+
job->start();
}
// A 404 is actually a success: we were authorized to know that the folder does
// not exist. It will be created later...
+ } else if (reply->error() == QNetworkReply::ContentAccessDenied) {
+ testTermsOfService();
+ return;
} else if (reply->error() == QNetworkReply::ContentNotFoundError) {
_ocWizard->successfulStep();
return;
return true;
}
+void OwncloudSetupWizard::testTermsOfService()
+{
+ _termsOfServiceChecker = new TermsOfServiceChecker{_ocWizard->account(), this};
+
+ connect(_termsOfServiceChecker, &TermsOfServiceChecker::done, this, &OwncloudSetupWizard::termsOfServiceChecked);
+ _termsOfServiceChecker->start();
+}
+
void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFolder, const QString &remoteFolder)
{
qCInfo(lcWizard) << "Setup local sync folder for new oC connection " << localFolder;
emit ownCloudWizardDone(QDialog::Accepted);
}
+void OwncloudSetupWizard::termsOfServiceChecked()
+{
+ if (_termsOfServiceChecker && _termsOfServiceChecker->needToSign()) {
+ QDesktopServices::openUrl(_ocWizard->account()->url());
+ } else {
+ _ocWizard->successfulStep();
+ delete _termsOfServiceChecker;
+ _termsOfServiceChecker = nullptr;
+ }
+}
+
AccountState *OwncloudSetupWizard::applyAccountChanges()
{
AccountPtr newAccount = _ocWizard->account();
namespace OCC {
class AccountState;
+class TermsOfServiceChecker;
class OwncloudWizard;
void slotAssistantFinished(int);
void slotSkipFolderConfiguration();
+ void termsOfServiceChecked();
+
private:
explicit OwncloudSetupWizard(QObject *parent = nullptr);
~OwncloudSetupWizard() override;
bool ensureStartFromScratch(const QString &localFolder);
AccountState *applyAccountChanges();
bool checkDowngradeAdvised(QNetworkReply *reply);
+ void testTermsOfService();
- OwncloudWizard *_ocWizard;
+ TermsOfServiceChecker *_termsOfServiceChecker = nullptr;
+ OwncloudWizard *_ocWizard = nullptr;
QString _initLocalFolder;
QString _remoteFolder;
};
quotaJob->setProperties(QList<QByteArray>() << "http://owncloud.org/ns:size");
connect(quotaJob, &PropfindJob::result, this, &OwncloudAdvancedSetupPage::slotQuotaRetrieved);
+ connect(quotaJob, &PropfindJob::finishedWithError, this, &OwncloudAdvancedSetupPage::slotQuotaRetrievedWithError);
quotaJob->start();
updateStatus();
}
+void OwncloudAdvancedSetupPage::slotQuotaRetrievedWithError(QNetworkReply *reply)
+{
+ Q_UNUSED(reply)
+ _rSize = -1;
+ _ui.lSyncEverythingSizeLabel->setText({});
+
+ updateStatus();
+}
+
qint64 OwncloudAdvancedSetupPage::availableLocalSpace() const
{
QString localDir = localFolder();